home *** CD-ROM | disk | FTP | other *** search
/ Chip: 25 Years Anniversary / CHIP_25Jahre_Jubilaeum.iso / G DATA AddOns2 / WebShop / _SETUP.1 / sb2basket.js < prev    next >
Text File  |  2001-12-20  |  11KB  |  216 lines

  1. <!-- sb2basket Basket functions           -->
  2. <!-- (c) Copyright 2001 GS Software       -->
  3. <!--                                      -->
  4. <SCRIPT LANGUAGE="JavaScript">
  5.  
  6. function showItems()
  7. {
  8.         var tablerowcolor = '#F0F0F0';
  9.  
  10.         totprice = 0;
  11.         totvat = 0;
  12.  
  13.         document.writeln('<!-- Begin Form updateform from permbasket.js -->');
  14.         document.writeln('<FORM NAME="updateform">');
  15.  
  16.         if (parent.theBasket.length>1) {
  17.           document.writeln('<DIV align="left">');
  18.           document.writeln('<TABLE class="basket" WIDTH=100% BORDER=0 CELLPADDING="2">');
  19.           document.writeln('<TR BGCOLOR="#C0C0C0"><TD class="basket"><b>'+parent.Loc_Article+'</b></TD><TD class="basket" align="right"><b>'+parent.Loc_Quantity+'</b></TD><TD class="basket" align="right"><b>'+parent.Loc_PriceEach+'</b></TD><td class="basket" align="right"><b>'+parent.Loc_PriceTotal+'</b></TD><TD class="basket"> </TD></TR>');
  20.           document.writeln('<TR BGCOLOR="F8F8F8"><TD class="basket" colspan="5"><HR></TD></TR>');
  21.         }
  22.         else {   
  23.           document.writeln('<DIV align="left">');
  24.           document.writeln('<TABLE class="basket" WIDTH=100% BORDER=0 CELLPADDING="2">');
  25.           document.writeln('<TR BGCOLOR="#C0C0C0"><TD class="basket"><b>'+parent.Loc_Article+'</b></TD><TD class="basket" align="right"><b>'+parent.Loc_Quantity+'</b></TD><TD class="basket" align="right"><b>'+parent.Loc_PriceEach+'</b></TD><td class="basket" align="right"><b>'+parent.Loc_PriceTotal+'</b></TD><TD class="basket"> </TD></TR>');
  26.           document.writeln('<TR BGCOLOR="F8F8F8"><TD class="basket" colspan="5"><HR></TD></TR>');
  27.           document.writeln('<TR BGCOLOR="F8F8F8"><TD class="basket" colspan="5"><B>'+parent.Loc_BasketEmpty+'</B></TD></TR>');
  28. //          document.writeln('</TABLE>');
  29.         }
  30.  
  31.          // NEU
  32.         if (parent.theBasket.length>1) {
  33.  
  34.  
  35.         for (var i = 1; i < parent.theBasket.length; i++)
  36.         {
  37.                 with(parent.theBasket[i])
  38.                 {
  39.                         theitem=Item;
  40.                         thequantity = Quantity; //fulllist.substring(itemstart, itemend);
  41.                         itemtotal = 0;
  42.                         if ((parseFloat(Price2)>0) && (parseInt(Quantity) >= parseInt(Quantity2)))
  43.                                 theprice=Price2
  44.                         else
  45.                                 if ((parseFloat(Price1)>0) && (parseInt(Quantity) >= parseInt(Quantity1)))
  46.                                         theprice=Price1
  47.                                 else
  48.                                         theprice = Price;
  49.                         itemtotal = (eval(theprice*thequantity));
  50.                         temptotal = itemtotal * 100;
  51.                         totprice = totprice + itemtotal;
  52.  
  53.                         thisvat = (parseFloat(itemtotal*productvatrate)) / (parseFloat(productvatrate)+parseFloat(100));
  54.                         thisvat = parseFloat(parent.alterError(thisvat));
  55.                         totvat = totvat + thisvat;
  56.         
  57.                         if(Attribut1=='') A1=''; else A1=', '+Attribut1;
  58.                         if(Attribut2=='') A2=''; else A2=', '+Attribut2;
  59.                         if(Attribut3=='') A3=''; else A3=', '+Attribut3;
  60.  
  61.                         itemlist=i;
  62.                         hilf="";
  63.                         if (Textin != "") hilf="<br> "+Textin;
  64.  
  65.                         document.write('<tr valign="top" BGCOLOR="'+tablerowcolor+'"><td class="basket">'+theitem+A1+A2+A3+hilf+'</td> ');
  66.                         document.write('<td nowrap class="basket" valign="top" align="right"><INPUT TYPE=TEXT class="inputbox" NAME="quant'+itemlist+'" VALUE="'+thequantity+'" SIZE=3> <a href="javascript:amendItem('+itemlist+',document.updateform.quant'+itemlist+'.value)"><img src="ok.gif" width="8" height="8" border="0" alt="Menge aktualisieren"></a> </td><td class="basket" valign="top" align="right">'+parent.alterError(theprice)+'</td><td class="basket" valign="top" align="right">'+parent.alterError(itemtotal)+'</td><td class="basket" align="center" valign="top">  <a href="javascript:removeItem('+itemlist+')"><img src="x.gif" width="8" height="8" border="0" alt="Artikel aus dem Warenkorb entfernen"></a>  </td></tr>');
  67.                         if (tablerowcolor == '#F0F0F0')
  68.                                 tablerowcolor = "#F8F8F8";
  69.                         else
  70.                                   tablerowcolor = "#F0F0F0";
  71.  
  72.                 }
  73.         }
  74.         document.writeln('<TR BGCOLOR="FCFCFC"><TD class="basket" colspan="5"><HR></TD></TR>');
  75.         document.writeln('<tr BGCOLOR="#C0C0C0"><td class="basket" colspan=3><b>'+parent.Loc_Total+'</b></td><td class="basket" align=right><b>{Currency} '+parent.alterError(totprice)+'</b></td><td class="basket"> </td></tr>');
  76.  
  77.         {IfUseCurrency1}
  78.         document.writeln('<TR BGCOLOR="#C0C0C0"><td class="basket" colspan=3>'+parent.Loc_InEuro+' {Currency1} '+parent.alterError(totprice*{CURRENCYCONVERTER1})+'</td><td class="basket" align=right></td><td class="basket"></td></tr>');
  79.         {ElseIfUseCurrency1}
  80.         {EndIfUseCurrency1}
  81.  
  82.         {IFSHOWVAT}
  83. //        document.writeln('<tr BGCOLOR="#C0C0C0"><td class="basket">'+parent.Loc_VAT+'</td><td class="basket" align=right colspan=2> '+{VATRATE}+"  %"+'</td><td class="basket" align=right>{Currency} '+parent.alterError(totprice*{VATRATE}/({VATRATE}+100))+'</td><td class="basket"> </td></tr>');
  84. //        document.writeln('<tr BGCOLOR="#C0C0C0"><td class="basket" colspan=3>'+parent.Loc_VAT+': {Currency} '+parent.alterError(totvat)+'</td><td class="basket" align=right></td><td class="basket"> </td></tr>');
  85.         {ENDIFSHOWVAT}
  86. }
  87.         document.writeln('</TABLE><cr>');
  88.         document.writeln('</div>');
  89.         document.writeln('</FORM>');
  90.         document.writeln('<!-- End Form updateform from permbasket.js -->');
  91. }
  92.  
  93.  
  94. function amendItem(itemno, newquant)
  95. {
  96.         if (!( (parseFloat(newquant) == parseInt(newquant) )&&( parseInt(newquant) > 0) ))
  97.                 alert(parent.Loc_Integer);
  98.         else
  99.                 parent.theBasket[parseInt(itemno)].Quantity=newquant;
  100.  
  101.         self.location = "basket.htm";
  102.         parent.basketframe.location = "permbasket.htm";
  103.  
  104. }
  105.  
  106.  
  107. function removeItem(itemno)
  108. {
  109.         parent.theBasket=parent.theBasket.slice(0,itemno).concat(parent.theBasket.slice(itemno+1,parent.theBasket.length));
  110.         self.location = "basket.htm";
  111.         parent.basketframe.location = "permbasket.htm";
  112. }
  113.  
  114. function clearBasket()
  115. {
  116.         if (confirm(parent.Loc_RemoveConfirm))
  117.                 parent.theBasket=parent.theBasket.slice(0,1);
  118.  
  119.         self.location = "basket.htm";
  120.         parent.basketframe.location = "permbasket.htm";
  121. }
  122.  
  123. function xminiBasket()
  124. {
  125.     var tablerowcolor = '#F0F0F0';
  126.     totprice = 0;
  127.  
  128.       if (parent.theBasket.length>1) {
  129.           for (var i = 1; i < parent.theBasket.length; i++)
  130.           {
  131.                 with(parent.theBasket[i])
  132.                 {
  133.                         theitem=Item;
  134.                         thequantity = Quantity; //fulllist.substring(itemstart, itemend);
  135.                         itemtotal = 0;
  136.                         if ((parseFloat(Price2)>0) && (parseInt(Quantity) >= parseInt(Quantity2)))
  137.                                 theprice=Price2
  138.                         else
  139.                                 if ((parseFloat(Price1)>0) && (parseInt(Quantity) >= parseInt(Quantity1)))
  140.                                         theprice=Price1
  141.                                 else
  142.                                         theprice = Price;
  143.                         itemtotal = (eval(theprice*thequantity));
  144.                         temptotal = itemtotal * 100;
  145.                         totprice = totprice + itemtotal;
  146.                         if(Attribut1=='') A1=''; else A1=', '+Attribut1;
  147.                         if(Attribut2=='') A2=''; else A2=', '+Attribut2;
  148.                         if(Attribut3=='') A3=''; else A3=', '+Attribut3;
  149.  
  150.                         itemlist=i;
  151.                         hilf="";
  152.                         if (Textin != "") hilf="<br> "+Textin;
  153.  
  154.  
  155.                 }
  156.           }
  157.  
  158.         document.writeln('<table class="basketsmall" width="100%" border="0" cellspacing="0" cellpadding="0">');
  159.  
  160.         document.writeln('<tr BGCOLOR="#F8F8F8">');
  161.  
  162.           document.write('<td width="50" nowrap class="basketsmall" align="left" valign="top"> <a href="main.htm" target="Hauptframe" onFocus="if(this.blur)this.blur()"><img src="kl_home.gif" border="0" align="absmiddle" alt="Home"></a>');
  163.           document.write(' <a href="basket.htm" target="Hauptframe" onFocus="if(this.blur)this.blur()"><img src="kl_fragezeichen.gif" border="0" align="absmiddle" alt="Warenkorb anzeigen"></a>');
  164.  
  165.           document.writeln('</td>');
  166.  
  167.             document.writeln('<td width="200" nowrap class="basketsmall" align="left" valign="top" nowrap>');
  168.             document.writeln((parent.theBasket.length-1)+ ' '+parent.Loc_InBasket+'</td>');
  169.           document.writeln('</td>');
  170.  
  171.  
  172.  
  173.           document.write('<td class="basketsmall" align="right" valign="top" nowrap>');
  174.             document.write(parent.alterError(totprice));
  175.             document.write(' {Currency}');
  176.  
  177.  
  178.             {IFUSECURRENCY1}
  179.             document.write(' ('+parent.alterError(totprice*{CURRENCYCONVERTER})+' Euro)');
  180.             {ENDIFUSECURRENCY1}
  181.           document.writeln('</td>');
  182.  
  183.  
  184.         document.writeln('</tr>');
  185.  
  186.         document.writeln('</table>');
  187.  
  188.       }
  189.       else {
  190.  
  191.         document.writeln('<table class="basketsmallempty" width="100%" border="0" cellspacing="0" cellpadding="0">');
  192.           document.writeln('<tr>'); // BGCOLOR="#C0C0C0"
  193.  
  194.               document.write('<td width="50" nowrap class="basketsmallempty" align="left" valign="top"> <a href="main.htm" target="Hauptframe" onFocus="if(this.blur)this.blur()"><img src="kl_home.gif" border="0" align="absmiddle" alt="Home"></a>');
  195.                  document.write(' <a href="basket.htm" target="Hauptframe" onFocus="if(this.blur)this.blur()"><img src="kl_fragezeichen.gif" border="0" align="absmiddle" alt="Warenkorb anzeigen"></a>');
  196.  
  197.                 document.writeln('</td>');
  198.  
  199.             document.writeln('<td width="200" nowrap class="basketsmallempty" align="left" valign="top">'+parent.Loc_BasketEmpty);
  200.                 document.writeln('</td>');
  201.  
  202.             document.writeln('<td class="basketsmallempty" align="right" valign="top"> </td>');
  203.           document.writeln('</tr>');
  204.         document.writeln('</table>');
  205.  
  206.  
  207.     }
  208.  
  209.  
  210.  
  211.  
  212.  
  213. }
  214.  
  215. </SCRIPT>
  216.